Skip to content

Auto collect dynamic SUT factories#1501

Open
bkorycki wants to merge 17 commits intomainfrom
auto-collect-factories
Open

Auto collect dynamic SUT factories#1501
bkorycki wants to merge 17 commits intomainfrom
auto-collect-factories

Conversation

@bkorycki
Copy link
Contributor

No description provided.

@bkorycki bkorycki requested review from superdosh and wpietri March 12, 2026 19:23
@bkorycki bkorycki requested a review from a team as a code owner March 12, 2026 19:23
@github-actions
Copy link

github-actions bot commented Mar 12, 2026

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@bkorycki bkorycki temporarily deployed to Scheduled Testing March 12, 2026 19:27 — with GitHub Actions Inactive
@bkorycki bkorycki temporarily deployed to Scheduled Testing March 12, 2026 19:31 — with GitHub Actions Inactive
@bkorycki bkorycki temporarily deployed to Scheduled Testing March 12, 2026 19:31 — with GitHub Actions Inactive
@bkorycki bkorycki temporarily deployed to Scheduled Testing March 12, 2026 23:59 — with GitHub Actions Inactive
Copy link
Contributor

@superdosh superdosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me overall, though I don't love the name.

Copy link
Contributor

@wpietri wpietri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the theory, but

  1. How do we know it works? I'd like to see a test that at least N factories are found under normal run conditions, and
  2. How do we make sure it keeps working? That is, if somebody adds a new factory, are we sure they'll do the right thing to make sure it shows up?

def _load_dynamic_sut_factories(self, secrets: RawSecrets) -> dict[str, DynamicSUTFactoryDriver]:
load_namespace("suts")
dynamic_sut_factories = {}
for cls in get_concrete_subclasses(DynamicSUTFactoryDriver): # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recollection is that in Python this only works for code that has already been imported. With the explicit imports gone, how are we sure that this will actually get everything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe load_namespace("suts") takes care of that.

@bkorycki bkorycki temporarily deployed to Scheduled Testing March 16, 2026 16:34 — with GitHub Actions Inactive
@bkorycki bkorycki temporarily deployed to Scheduled Testing March 16, 2026 16:55 — with GitHub Actions Inactive
@bkorycki
Copy link
Contributor Author

  1. A unit test for the actual collection is a great idea. I just added that.
  2. All it takes for a new factory to show up is to have it inherit from DynamicDriverSUTFactory. And I would expect that every time someone adds a new dynamic factory that they test that it works with some CLI command as a part of their normal workflow. We could also add a unit test for every dynamic factory to ensure it gets loaded. Though that requires people to remember to add that same unit test every time they add a new dynamic factory, so I don't know how much that actually accomplishes.

@bkorycki bkorycki requested a review from wpietri March 16, 2026 17:00
@bkorycki bkorycki temporarily deployed to Scheduled Testing March 16, 2026 18:38 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants